package xtable;

// typed table access point
public class Token {
	Token() {
	}

	public static void firstInsert(String key, xbean.Token value) throws Exception {
		_Tables_.getInstance().token.firstInsert(key, value);
	}

	public static xbean.Token get(String key) throws Exception {
		return _Tables_.getInstance().token.get(key);
	}

	public static xbean.Token get(String key, xbean.Token value) throws Exception {
		return _Tables_.getInstance().token.get(key, value);
	}

	public static void insert(String key, xbean.Token value) throws Exception {
		_Tables_.getInstance().token.insert(key, value);
	}

	public static void delete(String key) throws Exception {
		_Tables_.getInstance().token.delete(key);
	}

	public static boolean add(String key, xbean.Token value) throws Exception {
		return _Tables_.getInstance().token.add(key, value);
	}

	public static boolean remove(String key) throws Exception {
		return _Tables_.getInstance().token.remove(key);
	}

	public static xdb.TTableCache<String, xbean.Token> getCache() {
		return _Tables_.getInstance().token.getCache();
	}

	public static xdb.TTable<String, xbean.Token> getTable() {
		return _Tables_.getInstance().token;
	}

	public static xbean.Token select(String key) throws Exception {
		return getTable().select(key, new xdb.TField<xbean.Token, xbean.Token>() {
			public xbean.Token get(xbean.Token v) {
				return v.toData();
			}
		});
	}

	public static xbean.Token selectWithoutCache(String key) throws Exception {
		return getTable().selectWithoutCache(key, new xdb.TField<xbean.Token, xbean.Token>() {
			public xbean.Token get(xbean.Token v) {
				return v.toData();
			}
		});
	}

	public static xbean.Token selectWithoutCache4Rollback(String key) throws Exception {
		return getTable().selectWithoutCache4Rollback(key, new xdb.TField<xbean.Token, xbean.Token>() {
			public xbean.Token get(xbean.Token v) {
				return v.toData();
			}
		});
	}

	public static Long selectUserid(String key) throws Exception {
		return getTable().select(key, new xdb.TField<xbean.Token, Long>() {
				public Long get(xbean.Token v) {
					return v.getUserid();
				}
			});
	}

}
